#ifndef __H_BASEFUNC_H__
#define __H_BASEFUNC_H__

inline std::string find_kwd(const std::string &strbuf, LPCSTR lpkey)
{
	std::string temp;
	std::size_t pos = strbuf.find(lpkey);
	std::size_t posed;
	if(pos != std::string::npos)
	{
		posed = strbuf.find_first_of(" ", pos + 1);
		if (posed != std::string::npos)
		{
			temp = std::string(strbuf, pos, posed-pos);
		}
	}

	return temp;
}

inline std::string change_string(std::string& content, LPCSTR lpkey, std::string strrplace)
{
	std::string rst,temp;
	std::size_t pos = content.find(lpkey);
	std::size_t posed;
	if(pos != std::string::npos)
	{
		rst = std::string(content, 0, pos);
		rst += strrplace;
		posed = content.find_first_of(" ", pos + 1);
		if (posed != std::string::npos)
		{
			temp = std::string(content, posed);
			rst += temp;
		}
	}
	else
	{
		rst = strrplace + " " + content;
	}
	return rst;
}

#endif